import request from '@/utils/request/index'
import type { SkuResponseData, SkuInfoData } from './type'
enum API {
  SKU_URL = '/admin/product/list',
  CANCELSALE_URL = '/admin/product/cancelSale',
  SALE_URL = '/admin/product/onSale',
  SKUINFO_URL = '/admin/product/getSkuInfo',
  DELETESKU_URL = '/admin/product/deleteSku'
}

export const reqSkuList = (pageNo: number, limit: number) =>
  request.get<SkuResponseData>(`${API.SKU_URL}/${pageNo}/${limit}`)

export const reqSaleSku = (skuId: number) =>
  request.get<null>(`${API.SALE_URL}/${skuId}`)

export const reqCancelSale = (skuId: number) =>
  request.get<null>(`${API.CANCELSALE_URL}/${skuId}`)

export const reqSkuInfo = (skuId: number) =>
  request.get<SkuInfoData>(`${API.SKUINFO_URL}/${skuId}`)

  
export const reqRemoveSku = (skuId: number) =>
  request.delete<null>(`${API.DELETESKU_URL}/${skuId}`)
